package com.utils;

import com.model.vo.Edge;
import org.modelmapper.ModelMapper;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class ModelMapUtils {

    public static <T> List<T> mapIterator(Iterator<Map<String, Object>> iterator, Class<T> cls) {
        ModelMapper mapper = new ModelMapper();
        List result = new ArrayList<T>(10);
        while (iterator.hasNext()) {
            result.add(mapper.map(iterator.next(), cls));
        }
        return result;
    }
}
